<template>
	<view>
		<uni-byt-top-com title="支付密码弹窗" :backShow="backShow"></uni-byt-top-com>
		<scroll-view scroll-y="true" :style="{height:scrollHeight+'px'}">
			<view class="flex-col my-14 mx-15">
				<view class="flex-col my-14">
					<text class="text-size-16">支付密码弹窗(测试密码：123456)：</text>
					<text
						class="text-size-16 text-min-color mt-16">setPassPath="设置支付密码页面的路径(/pages/setPass/index)</text>
					<text class="text-size-16 text-min-color mt-16">不传setPassPath字段会提示</text>
				</view>
				<view class="flex-row">
					<u-button @click="passwordInputShow=true" type="warning">输入支付密码</u-button>
				</view>
				<!-- 支付密码输入 -->
				<!-- setPassPath="设置支付密码页面的路径(/pages/setPass/index)" -->
				<uni-byt-passwordInput @change="passChange" :show.sync="passwordInputShow"
					:passErrorShow.sync="passwordInputPassErrorShow">
				</uni-byt-passwordInput>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	import {
		getHeight
	} from "@/util"
	export default {
		data() {
			return {
				scrollHeight: getHeight(),
				backShow: false,
				// 支付密码输入框
				passwordInputShow: false,
				// 支付密码输入错误弹窗提示
				passwordInputPassErrorShow: false,
			}
		},
		onLoad(play) {
			if (play.backShow) {
				if (play.backShow == '1') {
					this.backShow = true
				}
			}
		},
		methods: {
			// 支付密码完成回调
			async passChange(password) {
				console.log('密码输入完成：', password);
				if (password != '123456') {
					this.passwordInputPassErrorShow = true
				} else {
					uni.$u.toast("密码正确")
				}
			},
		}
	}
</script>

<style>

</style>